﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace AssemblyStudy
{
	class Program
	{
		static void Main(string[] args)
		{
			//Assembly assem = Assembly.GetExecutingAssembly();

			Assembly assem = Assembly.LoadFrom(@"C:\Users\ZHF\Documents\Visual Studio 2008\Projects\CSharpStudy\AttributeStudy\bin\Debug\AttributeStudy.exe");

			Console.WriteLine("全名: " + assem.FullName);
			Console.WriteLine("版本: " + assem.GetName().Version);
			Console.WriteLine("初始位置: " + assem.CodeBase);
			Console.WriteLine("位置: " + assem.Location);
			Console.WriteLine("入口: " + assem.EntryPoint);

			foreach(Type t in assem.GetTypes())
			{
				Console.WriteLine("类型: " + t.Name);

				foreach (MemberInfo field in t.GetFields())
				{
					Console.WriteLine(" Field: " + field.Name);
				}
			}

			Console.WriteLine("动态创建类型实例");

			//Object obj = assem.CreateInstance("Animal", false, BindingFlags.ExactBinding,
			//                                null, new Object[]{2}, null, null);

			Console.ReadKey();
		}
	}
}
